package com.tangji.signaltower.runners;

import com.tangji.signaltower.disruptor.DisruptorHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * User: yujianfu (mr.vencnet@gmail.com)
 * Date: 2020-07-04
 * Time: 01:27
 */
@Component
public class DisruptorRunner implements CommandLineRunner {
    private static Logger logger = LoggerFactory.getLogger(DisruptorRunner.class);

    @Override
    public void run(String... strings) throws Exception {
        logger.info("初始化disruptor");
        new Thread(() -> {
            try {
                DisruptorHandler.init();
            } catch (Exception e) {
                logger.error("初始化disruptor异常", e);
                return;
            }
        }).start();
        logger.info("初始化disruptor完成");
    }
}
